import subprocess
import os

# Shell脚本的路径
script_path = os.path.join(os.getcwd(), 'build.sh')

# 执行Shell脚本
result = subprocess.run(['bash', script_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)

# 解析输出
errors = [line for line in result.stderr.split('\n') if line.startswith('[ERROR]') or line.startswith('[WARN]')]

# 打印错误信息
for error in errors:
    print(error)

# 检查脚本是否成功执行
if result.returncode != 0:
    print(f"脚本执行失败，返回码：{result.returncode}")
